<form method="post" name="formSearch" role="form" [formGroup]="formModel" (ngSubmit)="onSubmit($event)">
  <div class="form-group">
    <label class="for">商品名称</label>
    <input type="text" value="" class="form-control" placeholder="Please enter pruduct name." formControlName="title" [class.text-danger]="!this.formModel.get('title').valid" />
    <span [hidden]="!this.formModel.getError('minlength','title')" class="text-danger">名称长度最小为3</span>
  </div>
  <div class="form-group">
    <label class="for">商品价格</label>
    <input type="text" value="" class="form-control" placeholder="Please enter pruduct name." formControlName="price" [class.text-danger]="!this.formModel.get('price').valid" />
    <span [hidden]="!this.formModel.getError('positiveNum','price')" class="text-danger">商品价格不能为负数</span>
  </div>
  <div class="form-group">
    <label class="for">商品分类</label>
    <select class="form-control" formControlName="category">
      <option value="-1">全部分类</option>
      <option [value]="category" *ngFor="let category of categories">{{category}}</option>
    </select>
  </div>
  <div class="form-group">
    <button class="btn btn-primary">搜索</button>
  </div>
</form>
